import Loading from '@/views/Loading.vue';
import Home from '@/views/home/Home.vue';
import Login from '@/views/login/Login.vue';
import Space from '@/views/space/Space.vue';

// 动态路由
export const asyncRouteMap = [{
  path: '/product',
  name: 'product',
  meta: {
    title: '商品',
    menu: 'home',
    order: 5,
    icon: 'shopping-cart',
  },
  component: Home,
  children: [
    {
      path: 'list',
      name: 'productList',
      meta: {
        title: '商品列表',
        menu: 'home',
        order: 1,
        icon: 'menu',
      },
      component: () => import('@/views/home/pages/productList/ProductList.vue'),
    },
    {
      path: 'add',
      name: 'productAdd',
      meta: {
        title: '添加商品',
        menu: 'home',
        order: 3,
        icon: 'plus-circle',
      },
      component: () => import('@/views/home/pages/productAdd/ProductAdd.vue'),
    },
    {
      path: 'edit/:id',
      name: 'productEdit',
      meta: {
        title: '编辑商品',
        order: 2,
        icon: 'edit',
      },
      component: () => import('@/views/home/pages/productAdd/ProductAdd.vue'),
    },
    {
      path: 'category',
      name: 'category',
      meta: {
        title: '类目管理',
        menu: 'home',
        order: 3,
      },
      component: () => import('@/views/home/pages/category/Category.vue'),
    },
  ],
}];

export default [
  {
    path: '/',
    name: 'home',
    component: Home,
    redirect: '/index',
    meta: {
      auth: true,
      title: '首页',
      menu: 'home',
      order: -1,
      icon: 'home',
    },
    children: [{
      path: 'index',
      name: 'index',
      meta: {
        auth: true,
        title: '统计',
        menu: 'home',
        order: 1,
        icon: 'area-chart',
      },
      component: () => import('@/views/home/pages/index/Index.vue'),
    }],
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
  },
  {
    path: '/about',
    name: 'about',
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue'),
  },
  {
    path: '/loading',
    name: 'loading',
    component: Loading,
  },
  {
    path: '/space',
    name: 'space',
    component: Space,
    meta: {
      auth: true,
    },
  },
];
